// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

.profile-info {
  --avatar-radius-extended-desktop: 40px;
  --avatar-radius-extended: 20px;
  --avatar-radius: 20px;
  --avatar-size-extended-desktop: @profile-avatar-size;
  --avatar-size-extended: var(--content-height);
  --avatar-size: var(--content-height);

  --avatar-height: var(--avatar-size);
  --avatar-width: var(--avatar-size);

  --bg: none;

  --content-height: 65px;
  --vertical-padding: 10px;

  --info-margin-extended-desktop: 20px;
  --info-margin-extended: 10px;
  --info-margin: 10px;

  display: flex;
  flex-direction: column;
  flex: none;
  width: 100%;
  background-color: hsl(var(--hsl-b3));

  &--cover {
    --avatar-radius: var(--avatar-radius-extended);
    --avatar-size: var(--avatar-size-extended);
    --info-margin: var(--info-margin-extended);
  }

  &--multiplayer {
    background-color: hsl(var(--hsl-b4));
  }

  &--team {
    --avatar-width: calc(var(--avatar-height) * 2);
    --bg: url("~@images/headers/generic.jpg");
    background-color: hsl(var(--hsl-b4));
  }

  @media @desktop {
    --avatar-radius-extended: var(--avatar-radius-extended-desktop);
    --avatar-size-extended: var(--avatar-size-extended-desktop);
    --info-margin-extended: var(--info-margin-extended-desktop);
  }

  &__avatar {
    .own-layer(); // required by safari for border-radius to be applied correctly
    flex: none;
    width: var(--avatar-width);
    height: var(--avatar-height);
    border-radius: var(--avatar-radius);
    overflow: hidden;
    align-self: flex-start;
    .default-box-shadow();

    @media @desktop {
      margin-bottom: var(--vertical-padding);
      align-self: flex-end;
    }
  }

  &__bg {
    position: relative;
    background-image: var(--bg);
    background-size: cover;
    background-position: center;
    height: 100px;

    @media @desktop {
      height: 250px;
    }
  }

  &__cover-toggle {
    .center-content();
    position: absolute;
    height: 100%;
    top: 0;
    right: var(--gutter-size);

    @media @desktop {
      width: var(--gutter-size);
      right: 0;
    }
  }

  &__details {
    --gutter-size: @gutter-v2;
    --gutter-size-desktop: @gutter-v2-desktop;
    --details-vertical-padding: var(--vertical-padding);
    padding: var(--details-vertical-padding) var(--gutter-size);
    display: flex;
    align-items: center;
    position: relative;

    @media @desktop {
      --gutter-size: var(--gutter-size-desktop);
      --details-vertical-padding: 0; // handled by container height
      height: calc(var(--content-height) + var(--vertical-padding) * 2);
    }
  }

  &__flag {
    .link-plain();
    .link-white();
    display: grid;
    gap: 4px;
    align-items: center;

    @media @desktop {
      grid-template-columns: auto 1fr;
    }
  }

  &__flag-text {
    font-size: @font-size--title-small;
    display: none;

    @media @desktop {
      display: block;
    }
  }

  &__flags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    font-size: 15px; // icon size

    @media @desktop {
      flex-wrap: nowrap;
      gap: 10px;
      margin-top: 5px;
      font-size: @flag-size-medium; // icon size
    }
  }

  &__icon {
    font-size: 0.75em; // icon size
    height: (1em * 1em / $font-size); // revert sizing from font-size
    color: @osu-colour-c1;
    display: flex;
    text-shadow: none;

    &--supporter {
      .center-content();
      .link-plain();
      .link-white();
      border-radius: 10000px;
      background-color: hsl(var(--hsl-pink-1));
      padding: 0 10px;
    }
  }

  &__icons {
    &--flag-inline {
      display: contents;

      @media @desktop {
        display: none;
      }
    }

    &--name-inline {
      align-items: baseline;
      gap: 2px;
      margin-left: 5px;
      font-size: 15px; // icon size
      display: none;

      @media @desktop {
        display: flex;
      }
    }
  }

  &__info {
    .default-text-shadow();
    margin-left: var(--info-margin);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
  }

  &__level {
    flex: none;
  }

  &__name {
    padding: 0;
    margin: -5px 0 0;
    font-weight: normal;
    font-style: normal;
    line-height: normal; // prevent text clipping by u-ellipsis-overflow
    max-width: 100%;
    display: flex;
    align-items: center;
    position: relative;
    font-size: @font-size--large;

    @media @desktop {
      font-size: @font-size--title;
    }
  }

  &__previous-usernames {
    transform: translateY(-0.3em);
    display: inline-block;
    pointer-events: none;

    @media @desktop {
      transform: translateY(0);
      position: absolute;
      left: 100%;
      top: -16px;

      &:hover {
        z-index: @z-index--profile-previous-usernames;
      }
    }
  }

  &__spinner {
    display: none;

    @media @desktop {
      .center-content();
      .full-size();
      font-size: 60px;
      background-color: hsla(var(--hsl-b6), 0.5);
    }
  }

  &__title {
    .link-white();
    line-height: normal;
    font-size: @font-size--title-small;

    @media @desktop {
      font-size: @font-size--title-small-3;
    }
  }
}
